/**
 * @param {number} total
 * @param {number} cost1
 * @param {number} cost2
 * @return {number}
 */
 var waysToBuyPensPencils = function(total, cost1, cost2) {
  let ans = 0
  for(let i = 0; ; i++) {
    if(i * cost1 > total) break
    ans += Math.floor((total - i * cost1)/ cost2) + 1
  }
  return ans
};